package com.example.demo.service.impl;


import com.example.demo.entity.OrderItem;
import com.example.demo.mapper.OrderItemMapper;
import com.example.demo.service.OrderItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author chenqiuran
 * @decription 订单项服务
 * @date 2021/8/22
 */
@Service
public class OrderItemServiceImpl implements OrderItemService {

    @Autowired
    private OrderItemMapper orderItemMapper;

    @Override
    public List<OrderItem> findAllOrderItemByOrderId(Long OrderId, Integer index, Integer limit) {
        return orderItemMapper.findAllOrderItemByOrderIdWithRange(OrderId,index,limit);
    }

    @Override
    public Boolean addAllOrderItem(List<OrderItem> orderItemList) {
        return orderItemMapper.addAllOrderItem(orderItemList)>0;
    }

    @Override
    public Boolean deleteAllOrderItem(Long orderId) {
        return orderItemMapper.deleteAllOrderItem(orderId)>1;
    }
}
